package com.project.finance.mobile.product.service.impl;

import com.project.finance.common.mapper.TbCategoryMapper;
import com.project.finance.common.mapper.TbFinancialOrderMapper;
import com.project.finance.common.mapper.TbProductDetailMapper;
import com.project.finance.common.mapper.TbProductMapper;
import com.project.finance.common.po.TbFinancialOrder;

import com.project.finance.common.po.TbProductDetail;
import com.project.finance.common.vo.MobileProduct;
import com.project.finance.mobile.product.service.MobileProductService;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
@Slf4j
@Service
public class MobileProductServiceImpl implements MobileProductService {

    @Autowired
    private TbProductMapper tbProductMapper;

    @Autowired
    private TbProductDetailMapper tbProductDetailMapper;

    @Autowired
    private TbFinancialOrderMapper financialOrderMapper;

    @Autowired
    private TbCategoryMapper tbCategoryMapper;


    @Override
    public List<MobileProduct> listProduct() {
        List<MobileProduct> mobileProducts = tbProductMapper.listProduct();
        log.info(String.valueOf(mobileProducts));
        return mobileProducts;
    }


    @Override
    public int insert(TbFinancialOrder tbFinancialOrder) {
        return financialOrderMapper.insertSelective(tbFinancialOrder);
    }


    /*查询理财详情*/
    @Override
    public HashMap<String, Object> financialProduct(int productId) {
        TbProductDetail productDetails = tbProductDetailMapper.selectByPrimaryKey(productId);
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("productId",productDetails.getProductId());
        hashMap.put("productDesc",productDetails.getProductDesc());
        hashMap.put("productDetailRule",productDetails.getProductDetailRule());
        hashMap.put("ratesDesc",productDetails.getRatesDesc());
        return hashMap;
    }

}
